package com.atguigu.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * Redisson配置
 *
 * @author DuGuanghan
 * @since 2024-05-16 09:48:04
 */
@Configuration
public class MyRedissonConfig {
    @Bean(destroyMethod="shutdown")
    RedissonClient redisson() throws IOException {
        Config config = new Config();
        //可以用"redis://"或"rediss://"来启用SSL连接
        config.useSingleServer().setAddress("redis://192.168.56.100:6379");

        return Redisson.create(config);
    }
}
